﻿using System;
using System.Data;
using System.Web;
using AspNetInfo.Core;

namespace AspNetInfo.Detectors
{
    public class SessionVariablesDetector : IDetector
    {

        public DataTable Detect(EnvironmentPermissions permissions)
        {
            var context = HttpContext.Current;
            var dt = DetectorHelper.MakeResultTable();
            dt.Rows.Add("Variable Count", context.Session.Count.ToString());
            foreach (string key in context.Session.Contents.Keys)
            {
                dt.Rows.Add(key, context.Session[key].ToString());
            }
            return dt;
        }
        public string Name
        {
            get { return "Session Variables"; }
        }

        public string Description
        {
            get { return String.Empty; }
        }

        public string TabName
        {
            get { return Tabs.WebApp; }
        }
    }
}
